<template>
	<div class="orderfahuo">
		<div class="fahuo-box" v-show="!kuaidik">
			<h3 class="fahuo-title" v-text="indx==1?'发货':'修改单号'"></h3>
			<p class="fahuotishi" v-if="refund_status==1">退货退款提醒：订单中的部分商品，买家已提交了退款申请，您需要先跟买家协商，买家取消退款后，才能进行发货操作。</p>
			<ul class="fahuolist">
				<li @click="kuaidik=!kuaidik"><span :class="{'color2':xuanzeg}" v-text="xuanzeg==''?'请选择物流公司':xuanzeg"></span><i><img src="../../img-order/icon_next@3x.png" alt="" /></i></li>
				<li><input type="number" placeholder="请输入快递单号" v-model="kuaihao"/></li>
			</ul>
			<div class="gaijia-btn">
				<span @click="fahuosend">确定</span>
				<span @click="quxiaofa">取消</span>
			</div>
			
		</div>
		<ul class="kauidixuanze" v-show="kuaidik">
			<li v-for="item in kuaidilist" v-text="item" @click="xuanze(item)"></li>
		</ul>
	</div>
</template>

<script>
	export default{
		data(){
			return{
				token:0,
				kuaidik:false,
				xuanzeg:'',
				kuaihao:'',
				refund_status:0,
				kuaidilist:[
					'中通速递',
					'韵达快运',
					'顺丰速递',
					'天天快递',
					'邮政EMS',
					'申通快递',
					'百世汇通',
					'圆通快递',
					'其他'
				]
			}
		},
		props:['msg','indx'],
		created:function(){
			this.token=localStorage.getItem("nt_user");
			var self=this;
			$.ajax({
					type:'get',
					url:furl+'index.php?app=ajax_seller_member&act=order_shipped',
					data:{'token':self.token,'order_id':self.msg},
					dataType:'json',
					success:function(res){
						if(res.done){
							self.refund_status=res.retval.refund_status;
							if(self.indx==2){
								self.kuaihao=res.retval.invoice_no;
								if(res.retval.remark){
									self.xuanzeg=res.retval.remark;
								}
								
							}
						}
					}
				})
		},
		methods:{
			fahuosend:function(){
				var self=this;
				$.ajax({
					type:'post',
					url:furl+'index.php?app=ajax_seller_member&act=order_shipped',
					data:{'token':self.token,'order_id':self.msg,"remark":self.xuanzeg,'invoice_no':self.kuaihao},
					dataType:'json',
					success:function(res){
						if(res.done){
							self.$emit('fahuosuc',true);
							alert("发货成功");
						}else{
							alert("发货失败");
						}
					}
				})
			},
			quxiaofa:function(){
				this.$emit('fahuosuc',false);
			},
			xuanze:function(item){
				this.xuanzeg=item;
				this.kuaidik=false;
			}
		},
		mounted:function(){
			
		}
	}
</script>

<style>
	.orderfahuo{position:fixed;z-index: 9999;background-color:rgba(0,0,0,.4);top:0;bottom:0;left:0;right:0;}
	.fahuo-box{padding:0rem 0.24rem 0.24rem;background-color:#fff;width:6rem;border-radius:0.08rem;position:absolute;top:50%;left:50%;transform: translate(-50%,-50%);}
	.fahuo-title{text-align: center;font-size:0.32rem;color:#FF9C03;line-height: 0.96rem;border-bottom: 1px solid #eee;letter-spacing: 0.3rem;padding-left: 0.3rem;margin-bottom: 0.3rem;}
	.gaijia-btn{text-align: right;padding-top: 0.5rem;}
	.gaijia-btn>span:first-child{border-right:1px solid #eee;}
	.gaijia-btn>span{font-size:0.32rem;color:#2b2b2b;display: inline-block;width:1.5rem;text-align: center;line-height: 0.28rem;}
	.fahuotishi{font-size:0.24rem;color:#FF9C03;line-height: 0.28rem;padding-left: 0.5rem;padding-right: 0.2rem;}
	.fahuolist{padding-left: 0.5rem;}
	.fahuolist>li{font-size:0.32rem;color:#999;border-bottom: 1px solid #eee;height:0.8rem;line-height: 0.8rem;}
	.fahuolist>li>i{float:right;width:0.44rem;height:0.44rem;}
	.fahuolist>li>i>img{width:100%;}
	.fahuolist>li>.color2{color:#2B2B2B;}
	.fahuolist>li>input{width:100%;height:0.8rem;color:#2B2B2B;font-size:0.32rem;}
	.fahuolist>li ::-webkit-input-placeholder { /* WebKit browsers */ 
	color: #999; 
	} 
	.fahuolist>li :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ 
	color: #999; 
	} 
	.fahuolist>li ::-moz-placeholder { /* Mozilla Firefox 19+ */ 
	color: #999; 
	} 
	.fahuolist>li :-ms-input-placeholder { /* Internet Explorer 10+ */ 
	color: #999; 
	} 
	.kauidixuanze{padding:0rem 0.24rem;background-color:#fff;width:3rem;border-radius:0.08rem;position:absolute;top:50%;left:50%;transform: translate(-50%,-50%);}
	.kauidixuanze>li{font-size:0.32rem;line-height: 0.8rem;text-align: center;border-bottom: 1px solid #eee;}
	.kauidixuanze>li:last-child{border-bottom:none;}
</style>